#include<iostream>
using namespace std;

/*
    析构函数的调用顺序和构造函数相反
        先析构子类，再析构父类
*/

class Animal
{
public:
    Animal()
    {
        cout << "Animal()" << endl;
    }
    Animal(string _name , int _age)
    {
        name = _name;
        age = _age;
        cout << "Animal(string _name , int _age)"<<endl;
    }
    ~Animal()
    {
        cout << "父类的析构函数调用" << endl;
    }

    string name;
    int age;
};

class Cat : public Animal
{
public:
    Cat():Animal("小白",12)
    {
        cout << "Cat()" << endl;
    }
    Cat(string _name , int _age)
    {
        name = _name;
        age = _age;
        cout << "Cat(string _name , int _age)"<< endl;
    }
    ~Cat()
    {
        cout << "Cat的析构函数调用" << endl;
    }
};


int main()
{
    Cat c1;
    Cat c2("小花",10);

    return 0;
}